/**
 * Created by cchen on 2015/4/23.
 */

    var ua = navigator.userAgent.toLowerCase(),link = document.getElementById("link");
    if(ua.match("iphone") == "iphone"){
        //ios微信情况下
        if (ua.match(/MicroMessenger/i) == "micromessenger") {
            document.getElementById("link").addEventListener("click",function(){
                this.href = "http://a.app.qq.com/o/simple.jsp?pkgname=com.joinone.android.sixsixneighborhoods";
            },false);
        }
    }
 (function (w) {
    var data = {"url":"../../../js/download.json"},
    getData = function(res){
            var res = eval( "(" + res + ")" );
            var u = navigator.userAgent, app = navigator.appVersion;
            var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
            var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
            var ua = navigator.userAgent.toLowerCase();
            var isWx = ua.match(/MicroMessenger/i) === "micromessenger"
            var url = "#";
            var os = "";
            if (isAndroid) {
                url = res.android.default;
                os = "Android";
                $("div.device_text span").css("font-size", "16px");
                if (isWx) {
                    $('footer').show();
                    url = res.android.wx;
                    os = "Android";
                }
            }
            else if (isiOS) {
                url = res.ios.default;
                os = "iOS"
                if (isWx) {
                   $('footer').show();
                   url = res.android.wx;
                   os = "iOS";
                }
            }
            $("footer a").attr("href",url);
    }
    netWork(data,getData);
})(window); 